import Config from "../main.config";
import Ajax from "../utils/Ajax";
module.exports = {
    /*
    * 学校列表
    * */
    getList: async function (data = {limit: 20}) {
        let url = Config.api.collegeList;
        let res = await Ajax.request({
            method: "POST",
            url,
            data
        })
        return {
            count: res.count,
            data: res.data.map(function (item) {
                return {
                    sName: item.sName,
                    sNo: item.sNo
                }
            })
        }
    },
    /*
    * 获取专业列表
    * */
    getMajorList: async function (data = {}) {
        let url = Config.api.collegeMajorList;
        let res = await Ajax.request({
            method: "POST",
            url,
            data
        });
        return {
            count: res.count,
            data: res.data.map(function (item) {
                return {
                    name: item.name,
                    pNo: item.pNo,
                    no: item.no
                }
            })
        }
    },

    /*
    * 获取专业列表 无分页
    * */
    getMajorNoPageList: async function () {
        let url = Config.api.collegeMajorNoPageList;
        let res = await Ajax.request({
            method: "POST",
            url
        });
        return res.map(function (item) {
            return {
                name: item.name,
                no: item.no
            }
        })
    }
}
